chrome.extension.sendRequest({localstorage: "forp"}, function(response) {
var pref = response.forp;
if ( pref == "enabled" ){
	var css = '.row2 > span.nav > a.nav,.row1 > span.nav > a.nav,input[name="addbbcode10"],input[name="addbbcode12"],a.mainmenu[href*="phpbb2&file=memberlist.php"],a.mainmenu[href*="phpbb2&file=groupcp.php"],.topictitle > a img[title="View newest post"],.row1 * img[title="Goto page"]{display:none!important}';
	var nl = document.createElement("input");
	nl.setAttribute('type', 'button');
	nl.setAttribute('style', 'width: 55px');
	nl.setAttribute('value', 'N URL');
	nl.setAttribute('name', 'cusbbnl');
	nl.setAttribute('class', 'button');
	var nl2 = document.createElement("input");
	nl2.setAttribute('type', 'button');
	nl2.setAttribute('style', 'width: 64px');
	nl2.setAttribute('value', 'Img Link');
	nl2.setAttribute('name', 'cusbbn2');
	nl2.setAttribute('class', 'button');
	document.getElementsByName("addbbcode14")[0].parentNode.appendChild(nl2);
	document.getElementsByName("addbbcode16")[0].parentNode.appendChild(nl);
	nl2.addEventListener("click", imfu_cusimglink2, false);
	nl.addEventListener("click", imfu_cusnamelink2, false);
	var heads = document.getElementsByTagName("head");
		if (heads.length > 0) {
		var node = document.createElement("style");
		node.type = "text/css";
		node.appendChild(document.createTextNode(css));
		heads[0].appendChild(node); 
        }}});

function imfu_cusnamelink2(){
var lvalue = document.getElementsByName("message")[0];
var lurl = prompt("Enter Link", "");
var lname = prompt("Enter Name", "");
if(lurl==null || lname==null) { return; } 
else { lvalue.value = lvalue.value += "[url="+lurl+"]"+lname+"[/url]" }
} 

function imfu_cusimglink2(){
var lvalue = document.getElementsByName("message")[0];
var liurl = prompt("Enter Link", "");
var liname = prompt("Enter Image Link", "");
if(liurl==null || liname==null) { return; } 
else { lvalue.value = lvalue.value += "[url="+liurl+"][img]"+liname+"[/img][/url]" } 
}